package com.hanscan.gui;

import com.hanscan.persistence.entities.User;
import com.hanscan.util.language.LanguageConfig;
import com.hanscan.util.language.LanguageManager;
import com.sun.rave.web.ui.appbase.AbstractSessionBean;
import javax.faces.FacesException;


public class SessionBean1 extends AbstractSessionBean
{

    private LanguageConfig sessionBeanLanguage;
    private User user;

    private void _init() throws Exception 
    {
        loadLanguages();
    }

    public SessionBean1() {
    }

    /**
     * Método encargado de incializar el objeto LanguageManager y de realizar
     * la carga de los ficheros de idiomas.
     */
    private void loadLanguages()
    {
        LanguageManager.getInstance();
        sessionBeanLanguage = LanguageManager.getInstance().getLanguageConfig();
    }

    public void init()
    {
        super.init();
        try
        {
            _init();
        } 
        catch (Exception e)
        {
            log("SessionBean1 Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
        }
    }


    public void passivate()
    {
    }

    public void activate()
    {
    }

    public void destroy()
    {
    }

    public LanguageConfig getSessionBeanLanguage()
    {
        return sessionBeanLanguage;
    }

    public void setSessionBeanLanguage(LanguageConfig sessionBeanLanguage)
    {
        this.sessionBeanLanguage = sessionBeanLanguage;
    }

    public User getUser()
    {
        return user;
    }

    public void setUser(User user)
    {
        this.user = user;
    }



}
